package zgame.bean;

import zgame.socket.server.ServerConnection;

public class User {
  private String username;
  private int money;
  private boolean isReady;
  private int avatarId;
  private ChatRoom chatRoom;

  public ServerConnection server;

  public User(String username, ServerConnection server) {
    this.username = username;
    this.server = server;
  }

  public String getUsername() {
    return username;
  }

  public int getMoney() {
    return money;
  }

  public void setMoney(int money) {
    this.money = money;
  }

  public boolean isReady() {
    return isReady;
  }

  public void setReady(boolean isReady) {
    this.isReady = isReady;
  }

  public int getAvatarId() {
    return avatarId;
  }

  public void setAvatarId(int avatarId) {
    this.avatarId = avatarId;
  }
  
  public ChatRoom getChatRoom() {
    return chatRoom;
  }

  public void setChatRoom(ChatRoom chatRoom) {
    this.chatRoom = chatRoom;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    if (obj instanceof User) {
      User user = (User) obj;
      if (user.getUsername().equals(username)) {
        return true;
      }
    }
    return false;
  }
}
